.\" RCSid $Id: genBSDF.1,v 1.20 2017/05/31 17:25:21 greg Exp $
.TH GENBSDF 1 9/3/2010 RADIANCE
.SH NAME
genBSDF - generate BSDF description from Radiance or MGF input
.SH SYNOPSIS
.B genBSDF
[
.B "\-c Nsamp"
][
.B "\-n Nproc"
][
.B "\-r 'rcontrib opts...'"
][
.B "\-W"
][
.B "\-s 'x=string;y=string'"
][
.B "\-t{3|4} Nlog2"
][
.B "{+|-}C"
][
.B "{+|-}a"
][
.B "{+|-}forward"
][
.B "{+|-}backward"
][
.B "{+|-}mgf"
][
.B "{+|-}geom unit"
][
.B "\-dim Xmin Xmax Ymin Ymax Zmin Zmax"
]
[
.B "geom .."
]
.br
or
.br
.B genBSDF
.B "\-recover tempdir"
.SH DESCRIPTION
.I GenBSDF
computes a bidirectional scattering distribution function from
a Radiance or MGF scene description given on the input.
The program assumes the input is in Radiance format unless the
.I \+mgf
option is specified.
The output conforms to the LBNL Window 6 XML standard for BSDF data,
and will include an MGF representation of the input geometry if the
.I \+geom
option is given, followed by one of "meter," "foot," "inch,"
"centimeter," or "millimeter," depending on the scene units.
The default is to include the provided geometry,
which is assumed to be in meters.
Geometry output can be supressed with the
.I \-geom
option, which must also be followed by one of the above length units.
.PP
Normally,
.I genBSDF
computes components needed by a backwards ray-tracing process,
.I \+backward.
If both forward and backward (front and back) distributions are needed, the
.I \+forward
option may be given.
To turn off backward components, use the
.I \-backward
option.
Computing both components takes about twice as long as one component, but
is recommended when rays will be impinging from either side.
.PP
The
.I \+C
option specifies that the output XML should include color information,
which is interpreted by the rendering programs.
The default option
.I \-C
reduces all BSDF data to grayscale.
.PP
The
.I \-a
option turns off reciprocity averaging for tensor tree output.
Normally on (+a), this ensures that the tensor BRDF obeys Helmholtz reciprocity.
However, in certain rare cases, reciprocity averaging can cause unwanted noise in the output.
.PP
The geometry must fit a rectangular profile, whose width is along the X-axis,
height is in the Y-axis, and depth is in the Z-axis.
The positive Z-axis points into the room, and the input geometry should
not extend into the room.
(I.e., it should not contain any positive Z values, since the putative 
emitting surface is assumed to lie at Z=0.)\0
The entire window system should be modeled, including sills and
edge geometry anticipated in the final installation, otherwise
accuracy will be impaired.
Similarly, materials in the description should be carefully measured.
.PP
Normally, the input geometry will be positioned according to its actual
bounding box, but this may be overridden with the
.I \-dim
option.
Use this in cases where the fenestration system is designed to fit a
smaller (or larger) opening or is offset somehow.
.PP
The variance in the results may be reduced by increasing the number of
samples per incident direction using the
.I \-c
option.
This value defaults to 2000 samples distributed over the incoming plane
for each of the 145 Klems hemisphere directions.
.PP
On multi-core machines, processing time may be reduced by the
.I \-n
option, which specifies the number of simultaneous
processes to run in
.I rcontrib(1).
The
.I \-r
option may be used to specify a set of quoted arguments to be
included on the
.I rcontrib
command line.
.PP
The
.I \-W
option is passed to
.I wrapBSDF(1)
to prepare the XML file for WINDOW6.
Any
.I \-s
parameters are passed to the
.I \-f
option of
.I wrapBSDF,
controlling XML fields such as
the Manufacturer (e.g., -s m=MF) and device Name (e.g, -s n=NM).
.PP
The
.I \-t4
mode computes a non-uniform BSDF represented as a rank 4 tensor tree,
suitable for use in the Radiance rendering tools.
The parameter given to this option is the log to the base 2 of the
sampling resolution in each dimension, and must be an integer.
The
.I \-c
setting should be adjusted so that an appropriate number of samples
lands in each region.
A
.I \-t4
parameter of 5 corresponds to 32x32 or 1024 output regions, so a
.I \-c
setting of 10240 would provide 10 samples per region on average.
Increasing the resolution to 6 corresponds to 64x64 or 4096
regions, so the
.I \-c
setting would need to be increased by a factor of 4 to provide
the same accuracy in each region.
.PP
The
.I \-t3
mode is similar to
.I \-t4
but computes a rank 3 tensor tree rather than rank 4.
This provides a much faster computation, but only works
in special circumstances.
Specifically, do NOT use this option if the system is not in fact isotropic.
I.e., only use
.I \-t3
when you are certain that the system has a high degree of radial symmetry.
Again, the parameter to this option sets the maximum resolution as
a power of 2 in each dimension, but in this case there is one less
dimension being sampled.
.PP
The
.I \-recover
option is available for continuing calculations that were killed by
the system or the user.
Unfortunately, genBSDF puts its temporary files in a directory
that is often cleaned up after reboot, so this may not always work.
.SH EXAMPLE
To create a BSDF description including geometry from a set of venetian blinds:
.IP "" .2i
genblinds blind_white blind1 .07 3 1.5 30 40 | xform -rz -90 -rx 90 > blind1.rad
.br
genBSDF -r @rtc.opt blind_white.mat glazing.rad blind1.rad > blind1.xml
.PP
To create a non-uniform, anisotropic BSDF distribution with a maximum
resolution of 128x128 from the same description:
.IP "" .2i
genBSDF -r @rtc.opt -t4 7 -c 160000 blind_white.mat glazing.rad blind1.rad > blind12.xml
.SH NOTES
The variable resolution (tensor tree) BSDF representation is not supported
by all software and applicatons, and should be used with caution.
It provides practical, high-resolution data for use in the
Radiance rendering programs, but does not work in the matrix formulation
of the daylight coefficient method for example.
Also, third party tools generally expect or require a fixed number of sample
directions using the Klems directions or similar.
.SH AUTHOR
Greg Ward
.SH "SEE ALSO"
dctimestep(1), gendaymtx(1), genklemsamp(1), genskyvec(1), mkillum(1),
pkgBSDF(1), rcontrib(1), rfluxmtx(1), rmtxop(1), rtrace(1) wrapBSDF(1)
